Skip to content

Map os.ErrDeadlineExceeded to CodeDeadlineExceeded in-process - #1092

Closed
BahaaMattar wants to merge 1 commit into
connectrpc:mainfrom
BahaaMattar:fix/inprocess-os-deadline-exceeded
Closed

BahaaMattar wants to merge 1 commit into
connectrpc:mainfrom
BahaaMattar:fix/inprocess-os-deadline-exceeded

Conversation

@BahaaMattar

Copy link
Copy Markdown

Fixes #1091

A handler that returns an error matching os.ErrDeadlineExceeded, such as a
timed-out net.Conn read, reached an in-process client as CodeUnknown. Over
HTTP the same error is reported as CodeDeadlineExceeded (scrubHandlerError in
connecthttp checks it). asClientErr, which mirrors what a wire transport
reports, only checked context.DeadlineExceeded.

This also matches os.ErrDeadlineExceeded, so both transports agree.

Test: a new os_deadline_exceeded case in TestServerErrorDropsCause has a
handler return a wrapped os.ErrDeadlineExceeded and checks the client sees
CodeDeadlineExceeded, for a unary call and a server stream. It fails on main
(code = unknown, want deadline_exceeded) and passes with this change.

A handler that returns an error matching os.ErrDeadlineExceeded, such as a
timed-out net.Conn read, reached an in-process client as CodeUnknown. Over
HTTP the same error is reported as CodeDeadlineExceeded. The in-process
transport is meant to mirror what a wire transport reports, so treat it like
context.DeadlineExceeded.

Fixes connectrpc#1091

Signed-off-by: Bahaa Mattar <bahaa.kmattar@gmail.com>
@emcfarlane

Copy link
Copy Markdown
Contributor

Closing until issue is clear.

@emcfarlane emcfarlane closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

connectinprocess reports CodeUnknown for os.ErrDeadlineExceeded, connecthttp reports CodeDeadlineExceeded

2 participants